package Model;


import Model.permission.Permission;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import net.sf.oval.constraint.MatchPattern;
import net.sf.oval.constraint.ValidateWithMethod;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * 用户持久化类，数据库的字段被写成属性，及对应的get和set方法
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class User extends PageBean implements GeneralUser{

    private Integer user_id;  //序号
    private String user_number; //工号
    private String user_name; //用户名

    private String identity; //身份证号码
    private String user_sex;
    private  Integer user_age;
    private  String user_birthday;
    private  String user_mobile;
    private String user_email;
    private String family;
    private Date insert_time;
    private Date update_time;
    private String user_information;
    private Integer role_id; //角色id
    private String user_role; //角色名

    @JSONField(serialize = false)
    private String password; //密码

    private int status; //状态
    private String code;
    private String smsCode;
    private int attcount;
    private String jigou;
    private String department_settlement_code;

    @JSONField(serialize = false)
    @JsonIgnore
    private List<Permission> permissions;   //权限列表

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public void setJigou(String jigou) {this.jigou =jigou;}

    public String getJigou() {return jigou;}

    public void setDepartment_settlement_code(String department_settlement_code) {this.department_settlement_code = department_settlement_code;}

    public String getDepartment_settlement_code() {return department_settlement_code;}

    public String getIdentity() {
        return identity;
    }

    public void setIdentity(String identity) {
        this.identity = identity;
    }

    public Date getInsert_time () {
        return insert_time;
    }

    public Date getUpdate_time () {
        return update_time;
    }

    public void setUpdate_time (Date update_time) {
        this.update_time = update_time;
    }

    public Integer getUser_id () {
        return user_id;
    }
    //    public Integer getRole_id () {
//        return role_id;
//    }
    public void setInsert_time (Date insert_time) {
        this.insert_time = insert_time;
    }

    public void setUser_id (Integer user_id) {
        this.user_id = user_id;
    }

    public String getUser_number () {
        return user_number;
    }

    public void setUser_number (String user_number) {
        this.user_number = user_number;
    }

    public String getUser_name () {
        return user_name;
    }

    public void setUser_name (String user_name) {
        this.user_name = user_name;
    }

    public String getUser_sex () {
        return user_sex;
    }

    public void setUser_sex (String user_sex) {
        this.user_sex = user_sex;
    }

    public Integer getUser_age () {
        return user_age;
    }

    public void setUser_age (Integer user_age) {
        this.user_age = user_age;
    }

    public String getUser_birthday () {
        return user_birthday;
    }

    public void setUser_birthday (String user_birthday) {
        this.user_birthday = user_birthday;
    }

    public String getUser_mobile () {
        return user_mobile;
    }

    public void setUser_mobile (String user_mobile) {
        this.user_mobile = user_mobile;
    }

    public String getUser_email () {
        return user_email;
    }

    public void setUser_email (String user_email) {
        this.user_email = user_email;
    }

    public Integer getRole_id () {
        return role_id;
    }
    public void setRole_id (Integer role_id) {
        this.role_id = role_id;
    }

    public String getUser_role () {
        return user_role;
    }

    public void setUser_role (String user_role) {
        this.user_role = user_role;
    }

    @JsonIgnore
    public String getPassword () {
        return password;
    }

    public void setPassword (String password) {
        this.password = password;
    }

    public String getCode () {
        return code;
    }

    public void setCode (String code) {
        this.code = code;
    }

    public String getSmsCode () {
        return smsCode;
    }

    public void setSmsCode (String smsCode) {
        this.smsCode = smsCode;
    }

    public int getAttcount () {
        return attcount;
    }

    public void setAttcount (int attcount) {
        this.attcount = attcount;
    }

    public String getFamily () {
        return family;
    }

    public void setFamily (String family) {
        this.family = family;
    }

    public String getUser_information () {
        return user_information;
    }

    public void setUser_information (String user_information) {
        this.user_information = user_information;
    }

    public List<Permission> getPermissions() {
        return permissions;
    }

    public void setPermissions(List<Permission> permissions) {
        this.permissions = permissions;
    }


    @Override
    public String toString() {
//        return "User{" +
//                "user_id=" + user_id +
//                ", user_number='" + user_number + '\'' +
//                ", user_name='" + user_name + '\'' +
//                ", user_sex='" + user_sex + '\'' +
//                ", user_age=" + user_age +
//                ", user_mobile='" + user_mobile + '\'' +
//                ", user_email='" + user_email + '\'' +
//                ", user_relevantUser='" + user_relevantUser + '\'' +
//                '}';
        return JSON.toJSONString(this, SerializerFeature.DisableCircularReferenceDetect,
                SerializerFeature.WriteDateUseDateFormat);
    }
}
